package cn.javass.xgen;

import cn.javass.xgen.util.readxml.*;

public class MyTest {

    public static void main(String[] args) throws Exception {
        //1.表达式 -> 抽象语法树 解析器
        //2.抽象语法树 -> 交给解释器模式执行

        //构建抽象的语法树
//        ElementExpression genConf = new ElementExpression("GenConf", "");
//        ElementExpression needGens = new ElementExpression("NeedGens", "");
//        ElementsExpression needGen = new ElementsExpression("NeedGen", "");
//        ElementsExpression params = new ElementsExpression("Params", "");
//
//        ElementTerminalExpression param = new ElementTerminalExpression("Param", "");
//
//
//        genConf.addEle(needGens);
//        needGens.addEle(needGen);
//        needGen.addEle(params);
//        params.addEle(param);


        Context ctx = Context.getInstance("cn/javass/xgenconfxml/GenConf.xml");
        //String[] ss = genConf.interpret(ctx);
        String[] ss = Parse.parse("GenConf/NeedGens/NeedGen$/Params/Param[id=fileName1]").interpret(ctx);

        for(String s : ss){
            System.out.println("ss: "+s);
        }


    }
}
